package com.snail.monitor;

public class KeyboardAndMouseMonitor {

    private KeyboardMonitor keyboardMonitor;
    private MouseMonitor mouseMonitor;
    private MonitorRecord record = MonitorRecord.getInstance();

    private static KeyboardAndMouseMonitor instance = new KeyboardAndMouseMonitor();

    public static KeyboardAndMouseMonitor getInstance() {

        return instance;
    }

    private KeyboardAndMouseMonitor() {

    }

    public void startMonitor() {
        getRecord().reset();
        setKeyboardMonitor(new KeyboardMonitor(true, getRecord()));
        setMouseMonitor(new MouseMonitor(true, getRecord()));
        getKeyboardMonitor().start();
        getMouseMonitor().start();
    }

    public void stopMonitor() {

        getKeyboardMonitor().setRunning(false);
        getMouseMonitor().setRunning(false);
    }

    public KeyboardMonitor getKeyboardMonitor() {

        return keyboardMonitor;
    }

    public void setKeyboardMonitor(KeyboardMonitor keyboardMonitor) {

        this.keyboardMonitor = keyboardMonitor;
    }

    public MouseMonitor getMouseMonitor() {

        return mouseMonitor;
    }

    public void setMouseMonitor(MouseMonitor mouseMonitor) {

        this.mouseMonitor = mouseMonitor;
    }

    public MonitorRecord getRecord() {

        return record;
    }

    public void setRecord(MonitorRecord record) {

        this.record = record;
    }
}
